<?php

namespace App\Http\Middleware;

use App\Model\UserToken;
use Closure;

class CheckSign
{

    protected $iv = 'cl-123456';
    /**
     * @param  \Illuminate\Http\Request  $request
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $sign = md5($this->iv.$request->input('timestamp').$request->input('authInfo'));
        $appSign = $request->input('signature');
        if (!$appSign || $appSign !== $sign){
            return JsonResponse(404,true,'非法签名',$appSign,$sign);
        }
        return $next($request);
    }
}
